#ifndef __TEST_STEERING_AI_HPP__
#define __TEST_STEERING_AI_HPP__

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SmegAI/Entity/AIEntity.hpp>

#include <SmegTools/Debug/DebugNew.hpp>

////////////////////////////////////////////////////////////
/// Defines
////////////////////////////////////////////////////////////
#define DEFAULT_CIRCLE_DISTANCE 20.0f
#define DEFAULT_CIRCLE_RADIUS 5.0f

namespace smeg {
    namespace ai {

////////////////////////////////////////////////////////////
/// Represents an AI entity
////////////////////////////////////////////////////////////
class TestSteeringAI : public AIEntity {
public:
    ////////////////////////////////////////////////////////////
    /// Constructor
    ///
    /// \param _pRW :           Render window
    /// \param _Center :        Center of the entity
    /// \param _Velocity:       Velocity of the entity
    /// \param _fMass:          Mass of the entity
    /// \param _fMaxSpeed:      Maximum speed the entity can go
    /// \param _fAngleDeg :     Rotation angle
    /// \param _bIsStatic :     Static or dynamic ?
    ///
    ////////////////////////////////////////////////////////////
                                TestSteeringAI( sf::RenderWindow* _pRW,
                                    const sf::Vector2f& _Center         = sf::Vector2f(),
                                    const sf::Vector2f& _Velocity       = sf::Vector2f(),
                                    float _fMass                        = 1.0f,
                                    float _fMaxSpeed                    = DEFAULT_MAX_SPEED,
                                    float _fAngleDeg                    = 0.0f,
                                    bool _bIsStatic                     = false );
    ////////////////////////////////////////////////////////////
    /// Constructor with a sprite
    ///
    /// \param _pRW :           Render window
    /// \param _SpriteFilename : Sprite filename
    /// \param _Center :        Center of the entity
    /// \param _Velocity:       Velocity of the entity
    /// \param _fMass:          Mass of the entity
    /// \param _fMaxSpeed:      Maximum speed the entity can go
    /// \param _fAngleDeg :     Rotation angle
    /// \param _bIsStatic :     Static or dynamic ?
    ///
    ////////////////////////////////////////////////////////////
                                TestSteeringAI( sf::RenderWindow* _pRW,
                                    const std::string& _SpriteFilename, 
                                    const sf::Vector2f& _Center         = sf::Vector2f(),
                                    const sf::Vector2f& _Velocity       = sf::Vector2f(),
                                    float _fMass                        = 1.0f,
                                    float _fMaxSpeed                    = DEFAULT_MAX_SPEED,
                                    float _fAngleDeg                    = 0.0f,
                                    bool _bIsStatic                     = false );
    ////////////////////////////////////////////////////////////
    /// Copy Constructor
    ///
    /// \param _Copy :          Entity to copy from
    ///
    ////////////////////////////////////////////////////////////
                                TestSteeringAI( const TestSteeringAI& _Copy );
    ////////////////////////////////////////////////////////////
    /// Destructor
    ///
    ////////////////////////////////////////////////////////////
    virtual                     ~TestSteeringAI();

    CREATE_CLONE_FUNC( TestSteeringAI, core::PlaceableObject )
        
    ////////////////////////////////////////////////////////////
    /// Update the entity
    ///
    /// \param _fDeltaTime :    Time since the last frame
    ///
    ////////////////////////////////////////////////////////////
    virtual void                Update( float _fDeltaTime );

    /*********************** Behaviors ************************/
    void                        SetSeekWeight( float _Weight, core::BaseEntity* _pEntity, float _fSlowingRadius );
    void                        SetSeekWeight( float _fWeight );
    void                        SetSeekSlowingRadius( float _fSlowingRadius );

    void                        SetFleeWeight( float _fWeight, core::BaseEntity* _pEntity );
    void                        SetFleeWeight( float _fWeight );

    void                        SetPursueWeight( float _fWeight, core::BaseEntity* _pEntity );
    void                        SetPursueWeight( float _fWeight );

    void                        SetEvadeWeight( float _fWeight, core::BaseEntity* _pEntity );
    void                        SetEvadeWeight( float _fWeight );

    void                        SetWanderWeight( float _fWeight, float _fWanderDistance, float _fWanderRadius );
    void                        SetWanderWeight( float _fWeight );
    void                        SetWanderDistance( float _fWanderDistance );
    void                        SetWanderRadius( float _fWanderRadius );
    
    void                        SetSeekPursueEntity( core::BaseEntity* _pEntity );
    void                        SetFleeEvadeEntity( core::BaseEntity* _pEntity );
    
    float                       GetSeekWeight() const;
    float                       GetFleeWeight() const;
    float                       GetPursueWeight() const;
    float                       GetEvadeWeight() const;
    float                       GetWanderWeight() const;
    
    float                       GetSeekSlowingDistance() const;
    float                       GetWanderDistance() const;
    float                       GetWanderRadius() const;

protected:        
    friend class EntityManager;
    
    ////////////////////////////////////////////////////////////
    /// Default Constructor
    ///
    ////////////////////////////////////////////////////////////
                                TestSteeringAI();

    /******************* Protected members ********************/
    float                       m_fSeekWeight;
    float                       m_fFleeWeight;
    float                       m_fPursueWeight;
    float                       m_fEvadeWeight;
    float                       m_fWanderWeight;
    
    float                       m_fSeekSlowingRadius;
    float                       m_fWanderDistance;
    float                       m_fWanderRadius;
    
    core::BaseEntity*           m_pSeekPursueEntity;
    core::BaseEntity*           m_pFleeEvadeEntity;
};
    
inline float TestSteeringAI::GetSeekWeight() const {
    return m_fSeekWeight;
}

inline float TestSteeringAI::GetFleeWeight() const {
    return m_fFleeWeight;
}

inline float TestSteeringAI::GetPursueWeight() const {
    return m_fPursueWeight;
}

inline float TestSteeringAI::GetEvadeWeight() const {
    return m_fEvadeWeight;
}

inline float TestSteeringAI::GetWanderWeight() const {
    return m_fWanderWeight;
}

inline float TestSteeringAI::GetSeekSlowingDistance() const {
    return m_fSeekSlowingRadius;
}

inline float TestSteeringAI::GetWanderDistance() const {
    return m_fWanderDistance;
}

inline float TestSteeringAI::GetWanderRadius() const {
    return m_fWanderRadius;
}

    } // namespace ai
} // namespace smeg


#include <SmegTools/Debug/DebugNewOff.hpp>

#endif // __TEST_STEERING_AI_HPP__